package com.cjh.common.enums;

import com.baomidou.mybatisplus.annotation.EnumValue;

public enum StatusEnum implements Enumerator {
    ToBePrinted(1, "待打印"),
    PartsToBeTaken(2, "代取件"),
    ToBeDelivered(3, "待配送"),
    DeliveryCompleted(4, "配送完成"),
    TransactionCompletion(5, "交易完成"),
    EvaluateCompletion(6, "评价完成"),
    RefundInProgress(-1, "退款中"),
    Refunded(-2, "已退款"),
    RefundFailed(-3, "退款失败");
    StatusEnum(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @EnumValue
    private final Integer code;
    private final String desc;

    @Override
    public Integer code() {
        return this.code;
    }

    @Override
    public String desc() {
        return this.desc;
    }
    public static StatusEnum getEnumsByCode(Integer code) {
        for(StatusEnum item : StatusEnum.values()) {
            if(item.code().equals(code)) {
                return item;
            }
        }
        return null;
    }
}
